<script lang="ts" setup>
import type { UserTreePropEmits, UserTreeProps } from '../types/QueryCondition';
import { OrganizationSelection, TreeDataType, UserType } from '@minmetals-ui/biz-components';
import { UseUserTree } from '../hooks/UseUserTree';

const props = withDefaults(defineProps<UserTreeProps>(), {
  title: '',
});
const emits = defineEmits<UserTreePropEmits>();
const { title, dialogVisible, closeDialog, submitDialog, selectedValue, userTreeBaseProps } = UseUserTree(props, emits);
</script>

<template>
  <OrganizationSelection
    v-bind="userTreeBaseProps" :title="title" :tree-data-type_2="TreeDataType.User" :user-type_2="UserType.OrgUser"
    :value="selectedValue" :multiple="true" :visible="dialogVisible" @confirm="submitDialog" @cancel="closeDialog"
  />
</template>
